package com.sunday.volunteer.admin.http;

import com.sunday.common.model.ResultDO;
import com.sunday.volunteer.admin.entity.ApplyMember;
import com.sunday.volunteer.admin.entity.GroupType;
import com.sunday.volunteer.admin.entity.Member;
import com.sunday.volunteer.admin.entity.MyActivities;
import com.sunday.volunteer.admin.entity.MyMember;
import com.sunday.volunteer.admin.entity.UploadFileBack;
import com.sunday.volunteer.admin.entity.Version;

import java.util.List;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

/**
 * Created by Administrator on 2016/3/4.
 */
public interface VolunteerService {

    /**************************************综合*****************************************/
    /**
     * 创建 组织
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/group/apply")
    Call<ResultDO> apply(@Field("mobile") String mobile,
                         @Field("name") String name,
                         @Field("mobileName") String mobileName,
                         @Field("groupType") String groupType,
                         @Field("serviceArea") String serviceArea,
                         @Field("limitNumber") int limitNumber,
                         @Field("code") String code);
    /**
     * 组织类型
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/dictionary/select")
    Call<ResultDO<List<GroupType>>> select(@Field("type") String type);

    //登录
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/login")
    Call<ResultDO<Member>> login(@Field("mobile") String mobile,
                                 @Field("password") String password,
                                 @Field("loginType") int loginType);
    //忘记密码
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/forgetPassword")
    Call<ResultDO> forgetPassword(@Field("mobile") String mobile,
                                 @Field("newPassword") String newPassword,
                                 @Field("validateCode") String validateCode);
    //修改密码
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/updatePassword")
    Call<ResultDO> updatePassword(@Field("memberId") long memberId,
                                  @Field("oldPassword") String oldPassword,
                                  @Field("newPassword") String newPassword,
                                  @Field("validateCode") String validateCode);
    /**
     * 获取验证码
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/code/send")
    Call<ResultDO> sendCode(@Field("mobile") String mobile);
    /**
     * 校验验证码
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/code/check")
    Call<ResultDO> checkCode(@Field("mobile") String mobile,@Field("validateCode") String validateCode);

    /**
     *上传多张图片
     */
    @Multipart
    @POST("/volunteer/mobile/upload/uploadMultiFile")
    Call<ResultDO<List<UploadFileBack>>> uploadMultiFile(@Part("files") RequestBody files);
    /**
     *上传单张图片
     */
    @Multipart
    @POST("/volunteer/mobile/upload/uploadSingleFile")
    Call<ResultDO<UploadFileBack>> uploadSingleFile(@Part("file") RequestBody file);
    /**
     * 创建活动
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/createActivity")
    Call<ResultDO> createActivity(@Field("memberId") long memberId,
                         @Field("name") String name,
                         @Field("limitNumber") int limitNumber,
                         @Field("startTime") String startTime,
                         @Field("endTime") String endTime,
                         @Field("desc") String desc,
                         @Field("address") String address,
                         @Field("mainImage") String mainImage,
                         @Field("rollImages") String rollImages,
                         @Field("isPrivate") int isPrivate);

    /**
     *获取活动列表
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/getMyActivitys")
    Call<ResultDO<List<MyActivities>>> getMyActivitys(@Field("memberId") long memberId,
                                                      @Field("status") int status,
                                                      @Field("page") int page,
                                                      @Field("rows") int rows);
    /**
     *获取活动详情
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/getActivityDetail")
    Call<ResultDO<MyActivities>> getActivityDetail(@Field("activityId") long activityId,
                                                   @Field("memberId") long memberId);
    /**
     *取消活动
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/cancelActitvity")
    Call<ResultDO> cancelActitvity(@Field("activityId") long activityId,
                                                   @Field("memberId") long memberId);
    /**
     *获取申请
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/group/getRecords")
    Call<ResultDO<List<ApplyMember>>> getRecords(@Field("memberId") long memberId,
                                                 @Field("page") int page,
                                                 @Field("rows") int rows);

    /**
     *处理申请
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/group/handleJoin")
    Call<ResultDO> handleJoin(@Field("memberId") long memberId,
                                                      @Field("applyId") long applyId,
                                                      @Field("isAgree") boolean isAgree);

    /**
     *获取组织成员
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/group/getVolunteers")
    Call<ResultDO<List<MyMember>>> getVolunteers(@Field("memberId") long memberId,
                                                 @Field("page") int page,
                                                 @Field("rows") int rows);

    /**
     *版本更新
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/apk/getApkInfo")
    Call<ResultDO<Version>> getApkInfo(@Field("type") int type,
                                       @Field("versionCode") int versionCode);

    /**
     * 修改头像
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/updateMember")
    Call<ResultDO<Member>> updateLogo(@Field("memberId") Long memberId,
                                      @Field("logo") String logo);

    /**
     * 修改组织信息
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/updateMember")
    Call<ResultDO<Member>> updateMember(@Field("memberId") long memberId,
                                  @Field("name") String name,
                                  @Field("logo") String logo,
                                  @Field("mobileName") String mobileName,
                                  @Field("limitNumber") Integer limitNumber,
                                  @Field("serviceArea") String serviceArea,
                                  @Field("groupType") String groupType);

}
